Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fast_brake command for HWP rapid spindown #787

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

17-sugiyama
Copy link
Contributor

@17-sugiyama 17-sugiyama commented Oct 30, 2024

Description

Update brake command of hwp_supervisor.

Motivation and Context

WG team is trying to measure the time constant by changing the hwp frequency rapidly e.g. +2Hz to -2Hz.
Current brake command is designed for gentle spindown and it takes >10 min to start inverse rotation.
New option of brake command is expected to take <2 min to spindown.
https://docs.google.com/presentation/d/1-kgAFn2sVR3R_Hp8_HcEYgZ8_SoNihm-UwsMn-Skxto/edit?usp=sharing

How Has This Been Tested?

Not tested yet

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

Comment on lines +1189 to +1201
elif isinstance(state, ControlState.WaitForFastBrake):
f0 = query_pid_state()['current_freq']
time.sleep(5)
f1 = query_pid_state()['current_freq']
if f0 < 0.2 or (f1 > f0):
self.log.info("Turning off PMX and putting PCU in stop mode")
self.run_and_validate(clients.pmx.set_off)
self.run_and_validate(
clients.pcu.send_command,
kwargs={'command': 'stop'}, timeout=None
)
time.sleep(5)
return
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block of code seems largely similar to the block of code handling ControlState.WaitForBrake in lines 1149-1165, with the only difference being that this block doesn't wait for the rotor to completely spin down. It might be simpler to add a boolean attribute to ControlState.WaitForBrake named fast which determines whether or not to run lines 1160-1164.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also whenever the ControlState.WaitForFastBrake finishes, it should set the state to ControlState.Done

@bbixler500
Copy link
Contributor

In terms of content this all seems perfectly reasonable to me (although we should definitely test the fast brake process with an actual device before merging). However, structurally it might be best to merge the fast brake control states into the normal brake states, as they seem to share many of the same lines of code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants